<template>
  <div class="login-header" v-if="route.path === '/login'">
    <div class="login-header-content">
      <div class="login-logo">
        <img src="@/assets/images/site_logo.jpg" />
      </div>
      <div class="login-title">{{ title }}</div>
    </div>
  </div>

  <div class="login1-header" v-else>
    <div class="login1-header-content">
      <div class="logo">
        <div class="login1-logo">
          <img src="@/assets/images/site_logo.jpg" />
        </div>
        <div class="login1-title">{{ title }}</div>
      </div>

      <div class="tip">已有账号？<span @click="onToLoginClick">请登录></span></div>
    </div>
  </div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
defineProps({
  title: {
    default: '',
    required: false
  }
})

const onToLoginClick = () => {
  router.push('/login')
}
</script>

<style scoped lang="less">
.login-header,
.login1-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  box-sizing: border-box;
  background-color: var(--background);

  .login-header-content,
  .login1-header-content {
    width: 1080px;
    height: 90px;
    display: flex;
    align-items: center;

    .login-logo,
    .login1-logo {
      img {
        width: 100px;
        height: 50px;
      }
    }

    .login-title,
    .login1-title {
      color: var(--color-text);
    }
  }
}

.login-header {
  .login-logo {
    border-right: 1px solid #dcdfe6;
    padding-right: 15px;
    margin-right: 15px;
  }

  .login-title {
    font-size: 24px;
    font-weight: 600;
  }
}

.login1-header {
  border-bottom: 2px solid #16bfa7;
  .login1-header-content {
    justify-content: space-between;
  }
  .logo {
    display: flex;
    align-items: center;
  }
  .login1-logo {
    margin-right: 20px;
  }
  .login1-title {
    font-size: 20px;
    color: var(--color-text);
  }

  .tip {
    font-size: 14px;
    color: #999999;
    font-weight: 500;
    line-height: 20px;
    font-family: 'PingFangSC-Medium';

    span {
      color: #f2a103;
      cursor: pointer;
    }
  }
}
</style>
